package com.ohuang.demo

import android.annotation.SuppressLint
import android.app.Activity
import android.app.Application
import android.content.ContentProvider
import android.content.Intent
import android.util.Log
import androidx.core.app.CoreComponentFactory

@SuppressLint("NewApi", "RestrictedApi")
class AppComponentFactory: CoreComponentFactory() {
    private  val TAG = "AppComponentFactory"

    override fun instantiateApplication(cl: ClassLoader, className: String): Application {
        Log.d(TAG, "instantiateApplication: className=$className")
        return super.instantiateApplication(cl, className)
    }

    override fun instantiateActivity(
        cl: ClassLoader,
        className: String,
        intent: Intent?
    ): Activity {

        Log.d(TAG, "instantiateActivity: className=$className  intent=$intent")
        var newClass=className

        return super.instantiateActivity(cl, newClass, intent)
    }

    override fun instantiateProvider(cl: ClassLoader, className: String): ContentProvider {
        Log.d(TAG, "instantiateProvider: classname=$className")
        return super.instantiateProvider(cl, className)
    }
}